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