UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iCpR+4BdwfBhXLCSgMQztMglWNUCCTX+64B2EOKd1+U='
WHERE
key_id = '4962c700de6ee9a0e3c14ad0531dc1b20d10790459c3f4f77df50a5bc0b3de4f'
AND (
token = 'iCpR+4BdwfBhXLCSgMQztMglWNUCCTX+64B2EOKd1+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)