UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Azj2fKpSOnr9O+P0PtPGpZc0yw7V+8npEkXMZAwjaYU=' 
WHERE 
  key_id = '7431d83cce292ac196d25844200da04ba9d57aa82c8f436494f75c615a088c5a' 
  AND (
    token = 'Azj2fKpSOnr9O+P0PtPGpZc0yw7V+8npEkXMZAwjaYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034