UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gulfnotdd0Gfamt2yOBmyZQQP8Z/5zWwntcOGfD1CMQ=' 
WHERE 
  key_id = 'c7cb9aa496953c4c4344039e57c181b6c6d138d3ef183a802d7deabca766334f' 
  AND (
    token = 'Gulfnotdd0Gfamt2yOBmyZQQP8Z/5zWwntcOGfD1CMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036