UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Sn8b1eV7anXo5U4KRjvV6pfsiQji9Oo8wd28YoAtwc='
WHERE
key_id = '1e4b145781fe62f42ac26874989e6de0b41ae1bc84bd4befc72ad16a569e1571'
AND (
token = '4Sn8b1eV7anXo5U4KRjvV6pfsiQji9Oo8wd28YoAtwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)