UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c9CdpeCig0l4bAPLyPEqTV2bBg6GrEARoG4DYBYjtiU='
WHERE
key_id = '765588d945aeb4c996192fd4fad0e0871b14f89e885731d8ebb3e9458b18afae'
AND (
token = 'c9CdpeCig0l4bAPLyPEqTV2bBg6GrEARoG4DYBYjtiU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)