UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vUGOxiSwo168buFwiH81E3sP0lCwmasGartUtF5Url4=' 
WHERE 
  key_id = '23d5f1e57c0561bfae1d45a1fb4247744fe45af10cc57c02feca402c7b34d622' 
  AND (
    token = 'vUGOxiSwo168buFwiH81E3sP0lCwmasGartUtF5Url4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045