UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3G+sKfbKKRHbYjaYfTot59rLCtLC2r6WzQuiGInwhSI=' 
WHERE 
  key_id = '9854a66664a3b510ea1c897edbc8c2bf4f22dcc1120f224cdbeed5b24c40d6e4' 
  AND (
    token = '3G+sKfbKKRHbYjaYfTot59rLCtLC2r6WzQuiGInwhSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045