UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRiRxV+6x6sKCNUfCL6J5sXX7Y/W14RaeIBSacfltwc='
WHERE
key_id = '0ff54a1b06065ff05cc0ec1feee1613e0bbad67f6e4e35dca3b14388bdf53743'
AND (
token = 'NRiRxV+6x6sKCNUfCL6J5sXX7Y/W14RaeIBSacfltwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)