UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ozyx/ZI81vsWECiw5CECH+x+ia6KybwEgrSSOfqcDF8=' 
WHERE 
  key_id = '7be796bb20628f0ef25b545bbe7af72ee7ba0088e39e76f002a15853616d15be' 
  AND (
    token = 'Ozyx/ZI81vsWECiw5CECH+x+ia6KybwEgrSSOfqcDF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031