UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRAoc03YEoZijTj7vDR40ty+0hiE0Bt7jgSd4NS+420='
WHERE
key_id = '8e7fab8a2240b2707e6ad438a554a0d1fd15e6edff42acfff521ccebd0dd0051'
AND (
token = 'QRAoc03YEoZijTj7vDR40ty+0hiE0Bt7jgSd4NS+420='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)