UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/y5OiKuaTF8thCSJwNrYKABBeCCgUz3jBa+WyPJGYVU='
WHERE
key_id = 'c57af516082cddc7ae79e000e764f632ca1b350bcadd5d355126895211e7ef74'
AND (
token = '/y5OiKuaTF8thCSJwNrYKABBeCCgUz3jBa+WyPJGYVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)