UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3UN55Bn67JnqJ3xJWAXCu3tnUXEBApsvbi873xx3iP4='
WHERE
key_id = '338862a6afb790d09ede97ab6496f33391b3c130ffc448d672a8ee94a76055cc'
AND (
token = '3UN55Bn67JnqJ3xJWAXCu3tnUXEBApsvbi873xx3iP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)