UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thpBmdq2s5adXgU7PKd3dNDY38rFxa3YErwUPMJ9TUg='
WHERE
key_id = 'd7f510b8b475bbb0134dab2c8aa0240ec99ca662adfcf38aafdbfbe35d31fec4'
AND (
token = 'thpBmdq2s5adXgU7PKd3dNDY38rFxa3YErwUPMJ9TUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)