UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5bnZ+334eaFZ4+28MXfMd1cIWzp3BDAdI9x4WzedpbM='
WHERE
key_id = '32b622e5eac6fe8993d258ddedb92375d9d90b8baf49536beb61b897b08e1e1a'
AND (
token = '5bnZ+334eaFZ4+28MXfMd1cIWzp3BDAdI9x4WzedpbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)