UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wIZhHuw9yh5kHiWXiuxVKk25rkdjB312S3vuyZdg7o0=' 
WHERE 
  key_id = '7fd30b7bb67e93dd138219a519576ac76b242288d99c48e1a1e21debc66ee22d' 
  AND (
    token = 'wIZhHuw9yh5kHiWXiuxVKk25rkdjB312S3vuyZdg7o0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025