UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ntOTmrfKGiqtyhuQDAeOEpwZ7y4BPsovrWYYvS/t0Rw='
WHERE
key_id = '1160d75c0322d5a226b9176aadf6845d3e7c765d7ce930bb855d568a0bf0cba9'
AND (
token = 'ntOTmrfKGiqtyhuQDAeOEpwZ7y4BPsovrWYYvS/t0Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)