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