UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4tkCiYyi8neD8fo7UzPPbBnCSuXtCvNyQjyMGF7SyJE='
WHERE
key_id = 'd1a111d5b96af7e9662aa0c49a81fe8e17b2e55ce4e3b50cde54c0a2f5b79b0b'
AND (
token = '4tkCiYyi8neD8fo7UzPPbBnCSuXtCvNyQjyMGF7SyJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)