UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ysssYWGQb+ufZmIz2y5IU/W0Oq4eyziMXGD4yOBwuRw=' 
WHERE 
  key_id = 'bddae0b9625605558b3e09b09f6c66bafacff981808b64a646cd21b2c88c9f66' 
  AND (
    token = 'ysssYWGQb+ufZmIz2y5IU/W0Oq4eyziMXGD4yOBwuRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032