UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CkrHJkA8nPz3JiaJLDnUortW1YcRfKlMqvl5evnXkPI='
WHERE
key_id = 'f3e142962276f4b9c9c030db35fd0d046b0c490a687f8bcd1b7b4a6d33963fa4'
AND (
token = 'CkrHJkA8nPz3JiaJLDnUortW1YcRfKlMqvl5evnXkPI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)