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