UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'emt4aaU4AGySdjcQnpICedyMR+6+5yTYncSLHnj6E0o='
WHERE
key_id = '1ccf87fc73bb0c4d43c9586a8c366c323219daf93bc9f1e8475fabb0dddf0f64'
AND (
token = 'emt4aaU4AGySdjcQnpICedyMR+6+5yTYncSLHnj6E0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)