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