UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yTjMhXW3AjTM4Xt2yoikElRkDePTqp9jKvUJD8bAu3s='
WHERE
key_id = 'ad82fcae23519cb61ca7363cb1819dc485fdac16cc15b9b5369ea3c8e60dd794'
AND (
token = 'yTjMhXW3AjTM4Xt2yoikElRkDePTqp9jKvUJD8bAu3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)