UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1dQ3srO5MczNvYfyNMuGNHTNy5T+XmkdNvfYd+h86i8='
WHERE
key_id = '8ff96db70c6551eda25064a68392d9fe533368e5acefd02fd92ebfcf82093ae7'
AND (
token = '1dQ3srO5MczNvYfyNMuGNHTNy5T+XmkdNvfYd+h86i8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)