UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7X5HjrspoVOEZ29VRpbM0hZxECmn5eMDPBoObA1y2nc='
WHERE
key_id = '598e5210de0832f4807cb7aa9ada84f657a98d43d6bd0813ca570a080475ab65'
AND (
token = '7X5HjrspoVOEZ29VRpbM0hZxECmn5eMDPBoObA1y2nc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)