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