UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RqmRsj7CqFItwKnCa4b3sLYNrDKAZySEj+1OyPXkhmo='
WHERE
key_id = 'f7de9a96d0bed790a2e42a348cb17567942df063d7d3649ac266fafa90cd08f2'
AND (
token = 'RqmRsj7CqFItwKnCa4b3sLYNrDKAZySEj+1OyPXkhmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)