UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0nG5PJJyElPBmMQz1zSIYG2+7PeipsJRHlmmr2Ooz6w='
WHERE
key_id = '9caf4a1ed6a6d4a68f39e04fcfdbe1d4c78801d36d941da51008372f3e02abdf'
AND (
token = '0nG5PJJyElPBmMQz1zSIYG2+7PeipsJRHlmmr2Ooz6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)