UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hg3LaVSvaEi6hgF+KCQaraJKbC5UlRt0KP61OyaxxCc=' 
WHERE 
  key_id = '5b2215bb0b2ed7f8f2ee5caca6992c3ccfb6907615bf4a4c1e4977ada2431a21' 
  AND (
    token = 'hg3LaVSvaEi6hgF+KCQaraJKbC5UlRt0KP61OyaxxCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027