UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7pSn8cX1GTUxwvcsazsLlyPsS60jI4AOBN9PrOJro7Y='
WHERE
key_id = 'd570f4cbb5f04d45e6662c80778709f234c4007767a65f74f3bcb55aff8c3de6'
AND (
token = '7pSn8cX1GTUxwvcsazsLlyPsS60jI4AOBN9PrOJro7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)