UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YOM4cFo3B9Bx16/QFkOa+/KnZTovMHIxgXdMYC3afM8='
WHERE
key_id = '2a7233ea948ea697e22c98b1eb642dd4505304d1a5453aaf45dead083c52e8f0'
AND (
token = 'YOM4cFo3B9Bx16/QFkOa+/KnZTovMHIxgXdMYC3afM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)