UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c8jm3KJztyV4ADW/NpSQNNWb7VhJekMwFb+I4NC6j2g='
WHERE
key_id = 'bfb92b356187b265cd388567bcdd3c79a080cab6654dc7a6bfbc517bd8be8e2e'
AND (
token = 'c8jm3KJztyV4ADW/NpSQNNWb7VhJekMwFb+I4NC6j2g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)