UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXMBf22Q30TQTVXF76cCMo7Htuimx+JY/fLnAahDgIc='
WHERE
key_id = '800252e879922189c428e41cf3fa8ac0b54eb5d27bbabafa4789f0fe898c2ba8'
AND (
token = 'BXMBf22Q30TQTVXF76cCMo7Htuimx+JY/fLnAahDgIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)