UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c2mVp1XQCwAHkCEU34lpEpqeeH1mve078HJwTc89X/s=' 
WHERE 
  key_id = '64eba2d368f4e7934e362413de26e947dbe9b0f24140957fc8726160b72b8bc3' 
  AND (
    token = 'c2mVp1XQCwAHkCEU34lpEpqeeH1mve078HJwTc89X/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034