UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Zl8aypcoWqVvDi2YnFbQ9NSrHYejCz2rLoZjZ+/9rg=' 
WHERE 
  key_id = '5779e1e130daab337febfee92ef97dc97cfefded42a2e7c26e53699d1ea204ec' 
  AND (
    token = '8Zl8aypcoWqVvDi2YnFbQ9NSrHYejCz2rLoZjZ+/9rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032