UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ycOIPi1ScvuMrlcVjDIJE/V3IP/hl87GA5Y+od9d6nc='
WHERE
key_id = '38fbb8019690b95b6f4d5256f562a32f08c50a0c6a3fe2aad8ac400367dffc2e'
AND (
token = 'ycOIPi1ScvuMrlcVjDIJE/V3IP/hl87GA5Y+od9d6nc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)