UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HzdZ94QwnG0SLMcLMCG3UdOKHvy8tStme7/7HRgSB04='
WHERE
key_id = '07b0b04af1e7ea8569f91a13e95f08d2175d551dd80eff57c29e3f1d8bc8ef8a'
AND (
token = 'HzdZ94QwnG0SLMcLMCG3UdOKHvy8tStme7/7HRgSB04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)