UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nV9USCTdIG/slmZ2OBaxKzCTgRl/ARDa8NSsIc+6czw=' 
WHERE 
  key_id = '043b3038757c29c4cfe332df5216c2d101196f52ca91afc2e5d8a3b671c4182f' 
  AND (
    token = 'nV9USCTdIG/slmZ2OBaxKzCTgRl/ARDa8NSsIc+6czw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030