UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j9j7CKPxVPHWaJhz9yRE3miLI0j6tsLMFTUiqvY7CUE='
WHERE
key_id = '5bba9fc4960d3f4267a78bfebc3cd8a9394541b92094c9a4c4c04fbe13177436'
AND (
token = 'j9j7CKPxVPHWaJhz9yRE3miLI0j6tsLMFTUiqvY7CUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)