UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ifXiCSVT2KzVtICP0LXhBtTb2nzvPu7pgxUjhcEoLD8=' 
WHERE 
  key_id = '1dd450a9461997023aad5b189c139e4b55a6681f29d6eb6dc6203af189478823' 
  AND (
    token = 'ifXiCSVT2KzVtICP0LXhBtTb2nzvPu7pgxUjhcEoLD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045