UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm86x0iOHCiBGRtLii8FbGuhPYECGfp7bEb2xTSFe+yE=' 
WHERE 
  key_id = '837330a1f010259728878c7a861567fe510da06fc364078803eff97e17ca14b3' 
  AND (
    token = 'm86x0iOHCiBGRtLii8FbGuhPYECGfp7bEb2xTSFe+yE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030